using System;
using System.Collections.Generic;
using System.Diagnostics;
using NUnit.Framework;

namespace nzmq.tests
{
    [TestFixture]
    public class use_NzmqClientSocket_as_pair
    {
        [Test]
        public void Sending_back_and_forth()
        {
            using(var ctx = new NzmqContext())
            using(var there = ctx.CreatePairSocket())
            using (var here = ctx.CreatePairSocket())
            {
                there.Bind("inproc://there");
                here.Connect("inproc://there");

                here.Send("1");
                here.Send("2");

                Assert.AreEqual("1", there.Receive());
                there.Send("a");

                here.Send("3");
                Assert.AreEqual("a", here.Receive());

                there.Send("b");
                Assert.AreEqual("2", there.Receive());
                Assert.AreEqual("3", there.Receive());

                Assert.AreEqual("b", here.Receive());
            }
        }
    }
}